﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CMP.ERP.Model;
using CMP.ERP.BLL;
using System.Data;

namespace CMP.ERP.Admin.Controllers
{
    public class OrderReportController : Controller
    {
        //
        // GET: /OrderReport/
        ShipmentsBLL bll = new ShipmentsBLL();
        public ActionResult Index()
        {
            return View();
        }
        //年
        public ActionResult SelYear(string StartTime, string End_Time)
        {
            List<Shipments> list = new List<Shipments>();
            DataTable data = bll.SelYear(StartTime, End_Time);
            foreach (DataRow item in data.Rows)
            {
                Shipments e = new Shipments();
                e.Num = item["Num"].ToString();
                e.Tdate = item["Tdate"].ToString();
                list.Add(e);
            }
            return Json(list, JsonRequestBehavior.AllowGet);
        }
        //月
        public ActionResult SelMonth(string StartTime, string End_Time)
        {
            List<Shipments> list = new List<Shipments>();
            DataTable data = bll.SelMonth(StartTime, End_Time);
            foreach (DataRow item in data.Rows)
            {
                Shipments e = new Shipments();
                e.Num = item["Num"].ToString();
                e.Tdate = item["Tdate"].ToString();
                list.Add(e);
            }
            return Json(list);
        }
        //日
        public ActionResult SelDay(string StartTime, string End_Time)
        {
            List<Shipments> list = new List<Shipments>();
            DataTable data = bll.SelDay(StartTime, End_Time);
            foreach (DataRow item in data.Rows)
            {
                Shipments e = new Shipments();
                e.Num = item["Num"].ToString();
                e.Tdate = item["Tdate"].ToString();
                list.Add(e);
            }
            return Json(list);
        }

    }
}
